<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@include file="/taglibs.jsp"%>
<!doctype html>
<html>
<head>
<meta charset="UTF-8">
<meta name="viewport"
	content="initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
<link href="${ctx}/resources/semanticui/semantic.min.css"
	rel="stylesheet" type="text/css" />
<link href="${ctx}/resources/apps.css" rel="stylesheet" type="text/css" />
<title>注册信息</title>

</head>
<body>
	<div class="ui card segment" id="n-page">
		<c:choose>
			<c:when test="${(hunter.binded==1) }">
				<a class="ui red right ribbon label">已认证</a>
			</c:when>
			<c:otherwise>
				<a class="ui red right ribbon label">未认证</a>
			</c:otherwise>
		</c:choose>
		&nbsp;<br> &nbsp;<br>
		<h3 class="ui attached header" id="list-title">您的注册信息</h3>
		&nbsp;<br> &nbsp;<br>

		<c:choose>
			<c:when test="${employer.imgUrl != null }">
				<%--				<img  class="ui small centered image"  src="${ctx}/rs/${employer.imgUrl}">--%>
				<div>
					<div style="position: relative;border: 5px solid lightblue;width: 150px;height:150px;margin: 5px auto;border-radius: 50%;">
						<img src="${ctx}/rs/${hunter.imageUrl}" alt="选择并上传头像" id="avatar_img"
							 style="width: 140px;height: 140px;left:0;top: 0;border-radius: 50%;"/>
						<input type="file" id="avatar_file" name="avatar_file"
							   accept="image/jpg,image/png,image/gif"
							   style="width: 100%;height:100%;opacity: 0;position: absolute;left:0;top: 0;"/>
					</div>
					<span style="text-align: center; color: #C0C0C0">点击头像进行修改</span>
					<br/>
				</div>
			</c:when>
			<c:otherwise>
				<%--				<img  class="ui small centered image"  src="${employer.headImgUrl}">--%>
				<div style="position: relative;border: 5px solid lightblue;width: 150px;height:150px;margin: 5px auto;border-radius: 50%;">
					<img src="${hunter.headImgUrl}" alt="选择并上传头像" id="avatar_img"
						 style="width: 140px;height: 140px;left:0;top: 0;border-radius: 50%;"/>
					<input type="file" id="avatar_file" name="avatar_file"
						   accept="image/jpg,image/png,image/gif"
						   style="width: 100%;height:100%;opacity: 0;position: absolute;left:0;top: 0;"/>
					<span style="text-align: center; color: #C0C0C0">点击头像进行修改</span>
				</div>
			</c:otherwise>
		</c:choose>

		&nbsp;<br>&nbsp;<br>
		账号类型:
		<c:if test="${hunter.roleIds==0}">
			猎头
		</c:if>
		<c:if test="${hunter.roleIds==1}">
			职道顾问
		</c:if>
		<c:if test="${hunter.roleIds==2}">
			猎头和职道顾问
		</c:if>
		&nbsp;<br>&nbsp;<br>
		姓名：${hunter.name}&nbsp;<br>&nbsp;<br>
		英文名：${hunter.englishname}&nbsp;<br>&nbsp;<br>
		身份证：${hunter.idnumber}&nbsp;<br>&nbsp;<br>

		邮箱：${hunter.email}&nbsp;<br>&nbsp;<br>
		手机：${hunter.phone}&nbsp;<br>&nbsp;<br>
		从业时间：${hunter.workage}年&nbsp;<br>&nbsp;<br>
		城市：${hunter.cityName}&nbsp<br>&nbsp;<br>
		擅长领域：${hunter.domainName1}|${hunter.domainName2}|${hunter.domainName3}&nbsp;<br>&nbsp;<br>
<%--		备注：${hunter.comment}&nbsp;<br>&nbsp;<br>--%>

		可提供服务的类型：${orderDesc}
		<%-- ${hunter.serviceTags} --%>
		&nbsp;<br> &nbsp;<br>
		擅长职位类型：${fn:substring(hunter.bestdomain,1,99)}&nbsp;<br>&nbsp;<br>
		个人介绍：${hunter.advantage}
		<%-- ${hunter.bestdomain} --%>
		&nbsp;<br> &nbsp;<br> <input type="hidden" name="hunterid"
			id="hunterid" value="${hunter.id}" />

		<div class="ui center aligned segment" id="choice-buttons">
			<div class="fluid ui button" id="next">修改信息</div>
		</div>

	</div>

	<script src="${ctx}/resources/jweixin-1.0.0.js"></script>
	<script src="${ctx}/resources/semanticui/jquery-2.1.4.min.js"></script>
	<script src="${ctx}/resources/semanticui/semantic.js"type="text/javascript"></script>
	<script type="text/javascript">
		wx.config({
			debug : false,
			appId : "${config.appid}",
			timestamp : ${config.currenttimestamp},
			nonceStr : "${config.nonceStr}",
			signature : "${config.signatureStr}",
			jsApiList : [ 'checkJsApi', 'onMenuShareTimeline',
					'onMenuShareAppMessage', 'onMenuShareQQ',
					'onMenuShareWeibo', 'showOptionMenu', 'closeWindow' ]
		});

		var handler = {
			activate : function() {
				$(this).addClass('active').siblings().removeClass('active');

				if ($(this).attr('id') == 'next') {
					var hunterid = $('#hunterid').val();
					var getUrl = '${ctx}/wechat/hunter/toEdit.page';
					getUrl += '?hunterId=' + hunterid;

					$(this).addClass('disabled');

					location.href = getUrl;
				}

				if ($(this).attr('id') == 'closeit') {
					wx.closeWindow();
				}
			}
		};

		// 头像预览
		$("#avatar_file").change(function () {
			debugger;
			// 获取上传文件对象
			var imgs = $(this)[0].files[0];
			var formData = new FormData();//新建一个formData来储存需要传递的信息
			formData.append('file', imgs);//需要传递的字段image路径
			formData.append('type', 'hunter');//id
			$.ajax({
				type: 'POST',
				url: '${ctx}/rs/img/upload',
				data: formData,
				contentType:false,
				processData:false,
				dataType: 'json',
				success: function (data) {
					$("#avatar_img").attr("src", data.file);
				},
				error: function (err) {
					alert("修改出错，请稍后再试！");
				}
			});



		});

		$(document).ready(
		function() {
			$('.button').on('click', handler.activate);
			wx.ready(function() {
				wx.onMenuShareAppMessage({
							title : 'Headoffer--专业招聘平台----推荐有奖！',
							desc : '搭起企业和专业猎头的桥梁，为企业招募英才。',
							link : 'http://www.tiaonali.com${ctx}/wechat/hunter/shareservice.page',
							imgUrl : 'http://www.tiaonali.com${ctx}/resources/images/sharelogo.jpg',
							type : 'link'
						});
	
				wx.onMenuShareTimeline({
							title : 'Headoffer--专业招聘平台----推荐有奖！',
							desc : '搭起企业和专业猎头的桥梁，为企业招募英才。',
							link : 'http://www.tiaonali.com${ctx}/wechat/hunter/shareservice.page',
							imgUrl : 'http://www.tiaonali.com${ctx}/resources/images/sharelogo.jpg'
						});
	
				wx.showOptionMenu();
	
			});
		});
	</script>
</body>
</html>